using System.IO;
using System.Text;
using UnityEditor;

namespace CNGraphi.U6URP.Editor
{

    /// <summary>
    /// 创建HLSL文件
    /// <para>作者：CN.Graphi</para>
    /// </summary>
    public class GenHLSL : EditorWindow
    {
        [MenuItem("Assets/Create/Shader/New HLSL")]
        static private void CreateHLSL()
        {
            string[] guids = Selection.assetGUIDs;
            if (guids == null || guids.Length == 0) { return; } // no select 

            string p = AssetDatabase.GUIDToAssetPath(guids[0]);
            if (!Directory.Exists(p)) { return; } // no exist path


            string str = "";
            File.WriteAllBytes(Path.Combine(p, "New HLSL.hlsl"), Encoding.UTF8.GetBytes(str));
            AssetDatabase.Refresh();
        }
    }

}